From: David Härdeman Date: Wed, 24 Sep 2025 13:00:57 +0000 (+0200) Subject: dhcpv4: move and rename handle_dhcpv4() X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22http:/www.crowdsec.net/%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22?a=commitdiff_plain;h=0cf95c471d779cd3d4da661d31d53ec215e66d44;p=project%2Fodhcpd.git dhcpv4: move and rename handle_dhcpv4() Move handle_dhcpv4() below the function it calls (dhcpv4_handle_msg()) and rename it to dhcpv4_handle_dgram() for consistency with other function names. Signed-off-by: David Härdeman Link: https://github.com/openwrt/odhcpd/pull/264 Signed-off-by: Álvaro Fernández Rojas --- diff --git a/src/dhcpv4.c b/src/dhcpv4.c index b63104c..f52d815 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -325,15 +325,6 @@ static int dhcpv4_send_reply(const void *buf, size_t len, return sendto(*sock, buf, len, MSG_DONTWAIT, dest, dest_len); } -/* Handler for DHCPv4 messages */ -static void handle_dhcpv4(void *addr, void *data, size_t len, - struct interface *iface, _unused void *dest_addr) -{ - int sock = iface->dhcpv4_event.uloop.fd; - - dhcpv4_handle_msg(addr, data, len, iface, dest_addr, dhcpv4_send_reply, &sock); -} - /* DNR */ struct dhcpv4_dnr { uint16_t len; @@ -726,6 +717,15 @@ void dhcpv4_handle_msg(void *addr, void *data, size_t len, #endif } +/* Handler for DHCPv4 messages */ +static void dhcpv4_handle_dgram(void *addr, void *data, size_t len, + struct interface *iface, _unused void *dest_addr) +{ + int sock = iface->dhcpv4_event.uloop.fd; + + dhcpv4_handle_msg(addr, data, len, iface, dest_addr, dhcpv4_send_reply, &sock); +} + static bool dhcpv4_insert_assignment(struct list_head *list, struct dhcp_assignment *a, uint32_t addr) { @@ -1138,7 +1138,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable) goto out; } - iface->dhcpv4_event.handle_dgram = handle_dhcpv4; + iface->dhcpv4_event.handle_dgram = dhcpv4_handle_dgram; odhcpd_register(&iface->dhcpv4_event); } else { while (!list_empty(&iface->dhcpv4_assignments))